package com.wowangz.cms.syscore.api;

import java.io.Serializable;
import java.util.Date;

import com.wowangz.cms.user.pojo.User;

/**
 * Web上下文
 * 
 * @author kaixia
 */
@SuppressWarnings("serial")
public class UserContext implements Serializable {

	/**
	 * 登录语言
	 */
	private String local = "zh_CN";

	/**
	 * 登录时间
	 */
	private Date loginDate = null;

	/**
	 * 用户所拥有账户权限
	 *
	 */
	private String sysAccountListStr = null;

	/**
	 * 当前登录人信息
	 */
	private User loginUser = null;

	/**
	 * 当前使用模块
	 */
	private long moduleId = 0;

	/**
	 * 模块字符串，用于模块的显示
	 */
	private String moduleString = "";

	/**
	 * 菜单字符串，用于菜单的显示
	 */
	private String menuString = "";

	/**
	 * 业务提示信息
	 */
	private String message = "";
	/**
	 * 提示信息
	 *
	 */
	private String promptMessgae;
	private long messageType = MessageType.NONE;

	/**
	 * 业务提示信息类型
	 * 
	 * @author kaixia
	 *
	 */
	public static class MessageType {
		final public static long NONE = 0;
		final public static long INFO = 1;
		final public static long ERROR = 2;
	}

	private boolean closeWindow = false;

	public UserContext() {

	}

	public boolean isCloseWindow() {
		return closeWindow;
	}

	public void setCloseWindow(boolean closeWindow) {
		this.closeWindow = closeWindow;
	}

	public void setLocal(String local) {
		this.local = local;
	}

	public String getLocal() {
		return local;
	}

	public User getLoginUser() {
		return loginUser;
	}

	public void setLoginUser(User loginUser) {
		this.loginUser = loginUser;
	}

	public long getModuleId() {
		return moduleId;
	}

	public void setModuleId(long moduleId) {
		this.moduleId = moduleId;
	}

	public String getModuleString() {
		return moduleString;
	}

	public void setModuleString(String moduleString) {
		this.moduleString = moduleString;
	}

	public String getMenuString() {
		return menuString;
	}

	public void setMenuString(String menuString) {
		this.menuString = menuString;
	}

	public void setErrorMessage(String errorMessage) {
		this.message = errorMessage;
		this.messageType = MessageType.ERROR;
	}

	public void setInfoMessage(String infoMessage) {
		this.message = infoMessage;
		this.messageType = MessageType.INFO;
	}

	public long getMessageType() {
		return messageType;
	}

	public String getMessage() {
		final String temp = this.message;
		this.messageType = MessageType.NONE;
		this.message = "";
		return temp;
	}

	public void setPromptMessgae(String message) {
		this.promptMessgae = message;
	}

	public String getPromptMessgae() {
		return promptMessgae;
	}

	public Date getLoginDate() {
		return loginDate;
	}

	public void setLoginDate(Date loginDate) {
		this.loginDate = loginDate;
	}

	public String getSysAccountListStr() {
		return sysAccountListStr;
	}

	public void setSysAccountListStr(String sysAccountListStr) {
		this.sysAccountListStr = sysAccountListStr;
	}

}
